<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>计算器</title>
	</head>
	<body>
		<input type="text" id="num1">
	    <select name="" id="symbol">
			<option value="1">+</option>
			<option value="2">-</option>
			<option value="3">*</option>
			<option value="4">/</option>
		</select>
		<input type="text" id="num2">
		=<input type="text" id="num3">
		<button onclick="abc()">提交</button>
		<button onclick="a()">重置</button>
		</form>
	</body>
	<script type="text/javascript">
		var one=document.getElementById('num1').value;
		var symbo=document.getElementById('symbol').value;
		var two=document.getElementById('num2').value;
		var aa=0;
		function abc(){
			switch (symbo){
			case '1':
				aa=(parseFloat(one)+parseFloat(two));
			break;
			case '2':
			    aa=(parseFloat(one)-parseFloat(two));
			break;
			case '3':
			    aa=(parseFloat(one)*parseFloat(two));
			break;
			case '4':
			    aa=(parseFloat(one)/parseFloat(two));
			break;
		} 
		    num3.value=aa;
		}
		function a(){
			location.reload;
		} 
	</script>
</html>
